<?php
/**
 * Created by PhpStorm.
 * User: iceberg
 * Date: 2018-10-08
 * Time: 16:41
 */

namespace app\base\controller;


use app\service\StorageService;
use think\Controller;

class Storage extends Controller
{
    //仓库业务
    private $storageService;
    //初始化方法
    public function initialize()
    {
        $this->storageService = new StorageService();
    }
    //列表
    public function index()
    {
        $this->assign('list', $this->storageService->page());
        $this->assign('count', $this->storageService->count());
        return $this->fetch();
    }

    //创建
    public function create()
    {
        return $this->fetch();
    }

    //保存
    public function save()
    {
        return $this->storageService->save();
    }

    //编辑
    public function edit($id)
    {
        $this->assign('info', $this->storageService->edit($id));
        return $this->fetch();
    }

    //更新
    public function update()
    {
        return $this->storageService->update();
    }

    //删除
    public function delete($id)
    {
        return $this->storageService->delete($id);
    }
}